#ifndef _FT_PROTOCOL_H
#define _FT_PROTOCOL_H

//flags - check readme for descriptions
#define PKT_START 0x1
#define PKT_DATA 0x2
#define PKT_ACK 0x4
#define PKT_END 0x8
#define PKT_FCKSM 0x10
#define PKT_DISCON 0x20
#define PKT_NACK 0x40

#define PKT_HEADER_SIZE 20

struct ft_packet_t
{
  unsigned int flags;
  unsigned int seq_num;
  unsigned long checksum;
  unsigned long wstart;
  unsigned int length;
  unsigned char* data;
};

unsigned long ft_calc_checksum(char*,int);
char* ft_gen_packet(struct ft_packet_t*,int* size);
struct ft_packet_t*  ft_unpack_packet(char*,int);

#endif
